tools/libxc, hvm: Fix 1G page allocation algorithm
authorShan Haitao <haitao.shan@intel.com>
Fri, 28 Jan 2011 11:08:49 +0000 (11:08 +0000)
committerShan Haitao <haitao.shan@intel.com>
Fri, 28 Jan 2011 11:08:49 +0000 (11:08 +0000)
commit4df98b33c284d5f0e923e67b78a66d679636ca10
tree58e145ab7d531de5d07345f9b864c0e50d29fc48
parent07ba141ef11f998860f298fbdae9afd1e2df602c
tools/libxc, hvm: Fix 1G page allocation algorithm

Currently, cur_pages (which is used as index into page_array for
fetching gfns) is used to judge whether it is proper here to allocated
1G pages. However, cur_pages == page_array[cur_pages] only holds true
when it is below 4G. When it is above 4G, page_array[cur_pages] -
cur_pages = 256M.
As a result, when guest has 10G memory, 8 1G-pages are allocated. But
only 2 of them have their corresponding gfns 1G aligned. The other 6
are forced to split to 2M pages, as their starting gfns are 4G+256M,
5G+256M .................

Inside the patch, true gfns are used instead of cur_pages to fix this
issue.

Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
tools/libxc/xc_hvm_build.c